<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
    <div region="center" style="padding:1px;">
        <t:datagrid name="cbsInspectionAppointmentList" checkbox="false" fitColumns="true" title="巡检申请"
                    actionUrl="cbsInspectionAppointmentController.do?getInspectionAppointmentApprovalList" idField="id"
                    fit="true" queryMode="group" sortName="handleStatus" sortOrder="asc">
            <t:dgCol title="编号" width="120" field="id" hidden="true"></t:dgCol>
            <t:dgCol title="业务编号" width="120" field="busId" hidden="true"></t:dgCol>
            <t:dgCol title="巡检申请服务ID" width="120" field="inAppId" query="true" align="center"></t:dgCol>
            <t:dgCol title="影院名称" width="300" field="cinemaName" query="true" align="center"></t:dgCol>
            <t:dgCol title="设备SN" width="120" field="sn" hidden="true" query="true"></t:dgCol>
            <t:dgCol title="申请人" width="80" field="createName" align="center"></t:dgCol>
            <t:dgCol title="申请时间" width="120" field="createDate" formatter="yyyy-MM-dd hh:mm" query="true"
                     queryMode="group" align="center"></t:dgCol>
            <t:dgCol title="状态" width="120" field="status" replace="待处理_0,处理中_4,审批中_1,已完成_2,已取消_3" query="true"
                     align="center"></t:dgCol>
            <%--<t:dgCol title="节点名称" 	width="120" field="nodeName"  align="center"/>--%>
            <t:dgCol title="处理时间" width="120" field="endTime" formatter="yyyy-MM-dd hh:mm" align="center"/>
            <t:dgCol title="业务ID" width="120" field="busId" hidden="true"></t:dgCol>
            <t:dgCol title="任务ID" width="120" field="taskId" hidden="true"></t:dgCol>
            <t:dgCol title="实例ID" width="120" field="instId" hidden="true"></t:dgCol>
            <t:dgCol title="办理状态" width="120" field="handleStatus" replace="草稿_0,待办_1,已办_2" hidden="true"></t:dgCol>
            <t:dgCol title="操作" field="opt" width="200" align="center"></t:dgCol>
            <t:dgFunOpt title="办理" exp="handleStatus#eq#0"
                        funname="goHandleWindow(taskId,busId,instId,handleStatus,nodeName)"></t:dgFunOpt>
            <t:dgFunOpt title="办理" exp="handleStatus#eq#1"
                        funname="goHandleWindow(taskId,busId,instId,handleStatus,nodeName)"></t:dgFunOpt>
            <t:dgFunOpt title="查看" exp="handleStatus#eq#2"
                        funname="goHandleWindow(taskId,busId,instId,handleStatus,nodeName)"></t:dgFunOpt>
            <t:dgToolBar title="创建巡检申请" icon="icon-add" funname="addCreateTab"/>
        </t:datagrid>
    </div>
</div>
<script src="webpage/com/buss/cbsinspectionappointment/cbsInspectionAppointmentList.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        //给时间控件加上样式
        $("#cbsInspectionAppointmentListtb").find("input[name='createDate_begin']").attr("class", "Wdate").attr("style", "height:20px;width:90px;").click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd'});
        });
        $("#cbsInspectionAppointmentListtb").find("input[name='createDate_end']").attr("class", "Wdate").attr("style", "height:20px;width:90px;").click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd'});
        });

        $("#cbsInspectionAppointmentListtb").find("input[name='endTime_begin']").attr("class", "Wdate").attr("style", "height:20px;width:90px;").click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd'});
        });
        $("#cbsInspectionAppointmentListtb").find("input[name='endTime_end']").attr("class", "Wdate").attr("style", "height:20px;width:90px;").click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd'});
        });
    });

    function addCreateTab() {
        addOneTab('创建巡检申请', 'cbsInspectionAppointmentController.do?goAdd', '');
    }
    function goHandleWindow(taskid, busid, instid, status, nodeName) {
        var url = "";
        //status 0.草稿 1.待办 2.已办
        if (status == 0) {
            url = "cbsInspectionAppointmentController.do?goAdd&busId=" + busid + "&taskId=" + taskid + "&instId=" + instid;
        } else if (status == 1) {
            url = "cbsInspectionAppointmentController.do?goApproval&busId=" + busid + "&taskId=" + taskid + "&instId=" + instid;
        } else if (status == 2) {
            url = "cbsInspectionAppointmentController.do?goApproval&busId=" + busid + "&taskId=" + taskid + "&instId=" + instid + "&isDetail=0";
        }
        $.dialog({
            width: window.top.document.body.offsetWidth,
            height:window.top.document.body.offsetHeight-100,
            content: 'url:'+url,
            title : "办理",
            cache:false,
            lock : true,
            zIndex:1700,
            init:function (){
                top.myWindow = this;
            }
        }).zindex();
    }
</script>